<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // class 类
      // Perosn 函数
      class Perosn {
        constructor() {
          // this = {}
          // this.__proto__ = Person.prototype;
          this.name = "jack";
          this.age = 20;
          // return this;
        }
      }

      function Perosn() {
        this.name = "jack";
        this.age = 20;
      }
      // const p1 = Perosn();
      Perosn.prototype.say = function () {
        console.log("hello");
      };
      const p1 = new Perosn();
      console.log(p1);
      p1.say(); //hello
      console.log(p1.__proto__ === Perosn.prototype);
    </script>
  </body>
</html>
